//------------------------------------------------------------------------------
// The contents of this file are subject to the nopCommerce Public License Version 1.0 ("License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at  http://www.nopCommerce.com/License.aspx. 
// 
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
// See the License for the specific language governing rights and limitations under the License.
// 
// The Original Code is nopCommerce.
// The Initial Developer of the Original Code is NopSolutions.
// All Rights Reserved.
// 
// Contributor(s): _______. 
//------------------------------------------------------------------------------

using System;
using NopSolutions.NopCommerce.BusinessLogic.Model;


namespace NopSolutions.NopCommerce.Web.Administration.Modules
{
    public partial class AddressDisplay : BaseNopAdministrationUserControl
    {
        protected void Page_Load(object sender, EventArgs e) {

        }

        public Address Address {
            set {
                Address address = value;
                if (address != null) {
                    this.lblFullName.Text = Server.HtmlEncode(string.Format("{0} {1}", address.FirstName, address.LastName));
                    this.lblEmail.Text = Server.HtmlEncode(address.Email);

                    this.lblPhoneNumber.Text = Server.HtmlEncode(address.PhoneNumber);
                    this.lblFaxNumber.Text = Server.HtmlEncode(address.FaxNumber);
                    this.litMobilePhone.Text = Server.HtmlEncode(address.MobilePhoneNumber);

                    if (address.CompanyLegalForm) {
                        this.lblCompany.Text = Server.HtmlEncode(address.Company);
                        this.litCompanyFiscalCode.Text = Server.HtmlEncode(address.CompanyFiscalCode);
                        this.litCompanyTradeRegistryNumber.Text = Server.HtmlEncode(address.CompanyRegComNumber);
                        this.litCompanyBank.Text = Server.HtmlEncode(address.CompanyBank);
                        this.litCompanyBankAccount.Text = Server.HtmlEncode(address.CompanyBankAccount);
                    } else
                        this.pnlCompany.Visible = false;

                    this.lblAddress1.Text = Server.HtmlEncode(address.FullAddress);
                    this.pnlAddress2.Visible = false;
                    
                    if (address.Country != null)
                        this.lblCountry.Text = Server.HtmlEncode(address.Country.Name);
                    else
                        this.pnlCountry.Visible = false;
                    if (address.StateProvince != null)
                        this.lblStateProvince.Text = Server.HtmlEncode(address.StateProvince.Name);

                    this.lblCity.Text = Server.HtmlEncode(address.City);
                    this.lblZipPostalCode.Text = Server.HtmlEncode(address.ZipPostalCode);
                }
            }
        }

    }
}